﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;

namespace DELVE_GAME.ViewStructure
{
    class PotencyBar : Actor
    {
        private View game;
        private PlayerProfileManager profileManager;
        private SpriteFont font;

        public PotencyBar(View game, int x, int y, Sprite sprite, SpriteFont font, PlayerProfileManager manager)
        {
            // TODO: Complete member initialization
            this.game = game;
            this.profileManager = manager;
            this.x = x;
            this.y = y;
            this.sprite = sprite;
            this.font = font;
        }

        /*public virtual void setSprite(Sprite sprite)
        {
            this.sprite = sprite;
            imageIndex = 0;
        }*/

        public override void update()
        {
        }

        public override void draw(SpriteBatch sb)
        {
            if (visible)
            {
                if (sprite != null)
                {
                    Color color = Color.White;
                    color = profileManager.getPlayerColor(game.getCurrentPlayerIndex());
                    int potency = game.getCurrentPlayer().getPotency();
                    int h =  potency / 2;
                    sprite.draw(sb, this.x + this.offsetX, (this.y + this.offsetY)-h, this.imageIndex, 30.0, h, color);
                    sb.Begin();
                    sb.DrawString(font, "Current:\n  "+potency, new Vector2(this.x-12, (this.y + this.offsetY) - h - 40), color);
                    sb.End();


                    int futurePotency = game.getCurrentPlayer().futurePotencyGain;
                    int h2 = futurePotency / 2;
                    sprite.draw(sb, this.x + 60 + this.offsetX, (this.y + this.offsetY) - h2, this.imageIndex, 30.0, h2, color);
                    sb.Begin();
                    sb.DrawString(font, "Next:\n " + futurePotency, new Vector2(this.x + 50, (this.y + this.offsetY) - h2 - 40), color);
                    sb.End();
                }
            }
        }

        public override bool checkCollision(int x, int y)
        {
            return false;
            //throw (new NotImplementedException());
        }

        public override void mouseOver(int x, int y)
        {
            //throw (new NotImplementedException());
        }

        public override void mousePressed(int x, int y)
        {
            //throw (new NotImplementedException());
        }

        public override void mouseReleased(int x, int y)
        {
            //throw (new NotImplementedException());
        }

        public override void keyPressed(Keys key)
        {
            //throw (new NotImplementedException());
        }

        public override void keyReleased(Keys key)
        {
            //throw (new NotImplementedException());
        }
    }
}
